﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="AddUpdateProduct.aspx.cs" Inherits="AddUpdateProduct" Title="Add Update Product" %>
<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
    
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

    <script type="text/javascript" src="AdminTools/ckfinder/ckfinder.js"></script>
	<script type="text/javascript">

    function BrowseServer()
    {
	    // You can use the "CKFinder" class to render CKFinder in a page:
	    var finder = new CKFinder();
	    finder.basePath = "AdminTools/ckfinder";	// The path for the installation of CKFinder (default = "/ckfinder/").
	    finder.selectActionFunction = SetFileField;
	    finder.popup();

	    // It can also be done in a single line, calling the "static"
	    // popup( basePath, width, height, selectFunction ) function:
	    // CKFinder.popup( '../', null, null, SetFileField ) ;
	    //
	    // The "popup" function can also accept an object as the only argument.
	    // CKFinder.popup( { basePath : '../', selectActionFunction : SetFileField } ) ;
    }

    // This is a sample function which is called when a file is selected in CKFinder.
    function SetFileField( fileUrl )
    {
	    document.getElementById( 'ctl00_ContentPlaceHolder1_txtImage' ).value = fileUrl;
    }

	</script>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <div id="toolbar_box">
                    <div class="t">
                        <div class="t">
                            <div class="t"></div>
                        </div>
                    </div>
                    
                    <div class="m">
                        <div id="toolbar" class="toolbar">
                            <table class="toolbar">
                                <tr>
                                    <td id="toolbar_delete" class="button">
                                        <%--<a href="#" class="toolbar">
                                            <span class="icon-32-delete"></span>
                                        Xóa</a>--%>
                                        <asp:LinkButton runat="server" ID="lbtSave" onclick="lbtSave_Click">
                                            <span class="icon-32-save"></span>
                                            Lưu
                                        </asp:LinkButton>
                                    </td>
                                    <%--<td id="toolbar_update" class="button"><a href="#" class="toolbar"><span class="icon-32-edit"></span>Sửa</a></td>--%>
                                    <td id="toolbar_add" class="button"><a href="ProductManager.aspx" class="toolbar"><span class="icon-32-cancel"></span>Bỏ qua</a></td>
                                    <td id="toolbar_help" class="button"><a href="#" class="toolbar"><span class="icon-32-help"></span>Trợ giúp</a></td>
                                </tr>
                            </table>
                        </div>
                        <div class="header addupdate">
                            Thêm/Sửa Sản phẩm
                        </div>
                        <div class="clr"></div>
                    </div>
                    
                    <div class="b">
                        <div class="b">
                            <div class="b"></div>
                        </div>
                    </div>
    </div><!--End toolbar_box--------------------------------------------------->
            
                
    <div id="element-box">
                    <div class="t">
                        <div class="t">
                            <div class="t"></div>
                        </div>
                    </div>
                    
                    <div class="m">                        
                        <div class="divAddUpProduct" style="width:1000px">
                            <fieldset class="adminlist">
                                <legend>Chi tiết</legend>
                                <table class="admintable" width="100%">
                                    <tbody>                                        
                                        <tr>
                                            <td class="key">Tên sản phẩm :</td>
                                            <td>
                                                <asp:TextBox runat="server" ID="txtProductName" Width="250px"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="vlProductName" runat="server" Text="*" ControlToValidate="txtProductName"></asp:RequiredFieldValidator>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="key">Danh mục :</td>
                                            <td>
                                                <asp:DropDownList runat="server" ID="ddlCategory" Width="255"></asp:DropDownList>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="key">Giá :</td>
                                            <td>
                                                <asp:TextBox runat="server" ID="txtPrice" Width="250px"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="vlPrice" runat="server" Text="*" ControlToValidate="txtPrice" Display="Dynamic"></asp:RequiredFieldValidator>
                                                <asp:RangeValidator ID="vlRangPrice" runat="server" Text="*" Type="Double" MaximumValue="9000000" MinimumValue="1" ControlToValidate="txtPrice"></asp:RangeValidator>
                                                
                                            </td>
                                        </tr>
                                        
                                        <tr>
                                            <td class="key">Giá khuyễn mại:</td>
                                            <td>
                                                <asp:TextBox runat="server" ID="txtPromotionPrice" Width="250px"></asp:TextBox>
                                                <asp:RangeValidator ID="vlRangPromotionPrice" runat="server" Text="*" Type="Double" MaximumValue="9000000" MinimumValue="0" ControlToValidate="txtPromotionPrice"></asp:RangeValidator>
                                            </td>
                                        </tr>
                                                                                                                        
                                        <tr runat="server" visible="false" id="trImageProduct">
                                            <td class="key">Ảnh sản phẩm:</td>
                                            <td>
                                                <asp:Panel runat="server" ID="pnImageAll">
                                                    <asp:Repeater runat="server" ID="repeaterImage" 
                                                        onitemcommand="repeaterImage_ItemCommand">
                                                        <ItemTemplate>
                                                            <div id="ImgProduct">
                                                            <img src='<%# Container.DataItem %>' class="imgObject"/>
                                                            <asp:Button runat="server" ID="btDelete" Text="x" CommandArgument="<%# Container.DataItem %>" CommandName="delete" CssClass="deleteImage" CausesValidation="false"/>
                                                            </div>
                                                        </ItemTemplate>
                                                    </asp:Repeater>
                                                </asp:Panel>                                                
                                            </td>
                                        </tr>
                                        
                                        <tr>
                                            <td class="key">Chọn ảnh :</td>
                                            <td>
                                                <asp:TextBox runat="server" ID="txtImage" Width="250px"></asp:TextBox>
                                                <%--<asp:RequiredFieldValidator runat="server" ID="vlImage" ControlToValidate="txtImage"
                                                Text="*" Display="Dynamic" ValidationGroup="vlImageInfo"></asp:RequiredFieldValidator>--%>
                                                <input type="button" value="Duyệt Ảnh" onclick="BrowseServer();" />
                                                <asp:Button runat="server" ID="btAddImage" Text="Thêm Ảnh" OnClick="btAddImage_Click"  ValidationGroup="vlImageInfo"/>
                                            </td>
                                        </tr>
                                        
                                        <tr>
                                            <td class="key">Tình trạng :</td>
                                            <td>                                                
                                                <asp:RadioButtonList runat="server" ID="rdlRecordStatus" RepeatDirection="Horizontal">
                                                </asp:RadioButtonList>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="key">Thứ tự :</td>
                                            <td>                                                
                                                <asp:TextBox runat="server" ID="txtSorted" Width="100"></asp:TextBox>
                                                <asp:RequiredFieldValidator ID="vlSorted" runat="server" Text="*" ControlToValidate="txtSorted"></asp:RequiredFieldValidator>
                                                <asp:RangeValidator ID="vlRangSort" runat="server" Text="*" Type="Integer" MaximumValue="1000" MinimumValue="1" ControlToValidate="txtSorted"></asp:RangeValidator>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="key">Mô tả :</td>
                                            <td>                                                
                                                <CKEditor:CKEditorControl ID="ckeDescription" runat="server" basePath="AdminTools/ckeditor" Width="850px" Height="350px">
                                                    Biên soạn nội dung . . .
		                                        </CKEditor:CKEditorControl>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </fieldset>
                        </div><!--End divAddUpProduct--------------------------------------------------->
                    </div>
                    
                    <div class="b">
                        <div class="b">
                            <div class="b"></div>
                        </div>
                    </div>
    </div><!--End element-box--------------------------------------------------->
                
</asp:Content>

